// Prevents additional console window on Windows in release, DO NOT REMOVE!!
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]

mod code_translator_api;
use std::sync::Mutex;


#[tauri::command]
async fn deepseek_coder_api_handler(language: String, code_content: String) -> String {
    println!("开始调用api");
    match code_translator_api::c2rust_translation(&language, &code_content).await {
        Ok(result) => result,
        Err(error) => {
            println!("Error: {}", error);
            "An error occurred while processing the code".to_string()
        }
    }
}


fn main() {
    tauri::Builder::default()
        .invoke_handler(tauri::generate_handler![deepseek_coder_api_handler])
        .run(tauri::generate_context!())
        .expect("error while running tauri application");
}

